package com.example.hehecat.yuejian1.mvp.presenter;

import android.util.Log;

import com.example.hehecat.yuejian1.mvp.contract.ActivityCollectContract;
import com.example.hehecat.yuejian1.mvp.model.bean.ActivityBean;
import com.example.hehecat.yuejian1.mvp.model.ActivityCollectModel;

import java.util.List;

import rx.Subscriber;

import static com.chad.library.adapter.base.listener.SimpleClickListener.TAG;

public class ActivityCollectPresenter implements ActivityCollectContract.Presenter {

    private ActivityCollectContract.View view;
    private ActivityCollectContract.Model model;

    public ActivityCollectPresenter(ActivityCollectContract.View view){
        this.view = view;
        model = new ActivityCollectModel();
    }


    @Override
    public void updateAdapterData(int user_id) {
        model.getAllActivityCollect(user_id, new Subscriber<List<ActivityBean>>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(List<ActivityBean> activityBeans) {
                Log.d(TAG, "onNext: "+activityBeans.get(0).getActivityname());
                view.updateAdapterData(activityBeans);
            }
        });
    }
}
